package dvlp.jhlee.myhomeinventory.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2014-11-19 17:42:46")
/** */
public final class CommonModelMeta extends org.slim3.datastore.ModelMeta<dvlp.jhlee.myhomeinventory.model.CommonModel> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel> dummy = new org.slim3.datastore.StringAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel>(this, "dummy", "dummy");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.util.Date> created = new org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.util.Date>(this, "created", "created", java.util.Date.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.lang.Long> id = new org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.lang.Long>(this, "id", "id", long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.util.Date> modified = new org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.util.Date>(this, "modified", "modified", java.util.Date.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.lang.Boolean> wasDeleted = new org.slim3.datastore.CoreAttributeMeta<dvlp.jhlee.myhomeinventory.model.CommonModel, java.lang.Boolean>(this, "wasDeleted", "wasDeleted", java.lang.Boolean.class);

    private static final CommonModelMeta slim3_singleton = new CommonModelMeta();

    /**
     * @return the singleton
     */
    public static CommonModelMeta get() {
       return slim3_singleton;
    }

    /** */
    public CommonModelMeta() {
        super("CommonModel", dvlp.jhlee.myhomeinventory.model.CommonModel.class);
    }

    @Override
    public dvlp.jhlee.myhomeinventory.model.CommonModel entityToModel(com.google.appengine.api.datastore.Entity entity) {
        dvlp.jhlee.myhomeinventory.model.CommonModel model = new dvlp.jhlee.myhomeinventory.model.CommonModel();
        model.setDummy((java.lang.String) entity.getProperty("dummy"));
        model.setKey(entity.getKey());
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        model.setCreated((java.util.Date) entity.getProperty("created"));
        model.setId(longToPrimitiveLong((java.lang.Long) entity.getProperty("id")));
        model.setModified((java.util.Date) entity.getProperty("modified"));
        model.setWasDeleted((java.lang.Boolean) entity.getProperty("wasDeleted"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        dvlp.jhlee.myhomeinventory.model.CommonModel m = (dvlp.jhlee.myhomeinventory.model.CommonModel) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("dummy", m.getDummy());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("created", m.getCreated());
        entity.setProperty("id", m.getId());
        entity.setProperty("modified", m.getModified());
        entity.setProperty("wasDeleted", m.getWasDeleted());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        dvlp.jhlee.myhomeinventory.model.CommonModel m = (dvlp.jhlee.myhomeinventory.model.CommonModel) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        dvlp.jhlee.myhomeinventory.model.CommonModel m = (dvlp.jhlee.myhomeinventory.model.CommonModel) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        dvlp.jhlee.myhomeinventory.model.CommonModel m = (dvlp.jhlee.myhomeinventory.model.CommonModel) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        dvlp.jhlee.myhomeinventory.model.CommonModel m = (dvlp.jhlee.myhomeinventory.model.CommonModel) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        dvlp.jhlee.myhomeinventory.model.CommonModel m = (dvlp.jhlee.myhomeinventory.model.CommonModel) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getDummy() != null){
            writer.setNextPropertyName("dummy");
            encoder0.encode(writer, m.getDummy());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        if(m.getCreated() != null){
            writer.setNextPropertyName("created");
            encoder0.encode(writer, m.getCreated());
        }
        writer.setNextPropertyName("id");
        encoder0.encode(writer, m.getId());
        if(m.getModified() != null){
            writer.setNextPropertyName("modified");
            encoder0.encode(writer, m.getModified());
        }
        if(m.getWasDeleted() != null){
            writer.setNextPropertyName("wasDeleted");
            encoder0.encode(writer, m.getWasDeleted());
        }
        writer.endObject();
    }

    @Override
    protected dvlp.jhlee.myhomeinventory.model.CommonModel jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        dvlp.jhlee.myhomeinventory.model.CommonModel m = new dvlp.jhlee.myhomeinventory.model.CommonModel();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("dummy");
        m.setDummy(decoder0.decode(reader, m.getDummy()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        reader = rootReader.newObjectReader("created");
        m.setCreated(decoder0.decode(reader, m.getCreated()));
        reader = rootReader.newObjectReader("id");
        m.setId(decoder0.decode(reader, m.getId()));
        reader = rootReader.newObjectReader("modified");
        m.setModified(decoder0.decode(reader, m.getModified()));
        reader = rootReader.newObjectReader("wasDeleted");
        m.setWasDeleted(decoder0.decode(reader, m.getWasDeleted()));
        return m;
    }
}